package com.scs.application.modules.wm.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.entity.FlowEntity;
import com.scs.application.modules.upgrade.db.annotation.EntityClassAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityIndexAnnotation;
import com.scs.application.modules.upgrade.db.enums.EntityFieldType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
/**
 * <p>
 *
 * </p>
 */
@Data
@Accessors(chain = true)
@TableName("wm_work_order")
@EntityIndexAnnotation(ux = {"bus_key"},
        ix = {"bus_type","ref_id","supplier_id","warehouse_id","bus_date","flag_consignment","flag_omoc","flow_status","dept_id"}
)
@EntityClassAnnotation(remark = "出入库表")
public class WorkOrder extends FlowEntity {


    // id ,在父类中处理

    @EntityFieldAnnotation(
            text = "=purchase_order.id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String purchaseOrderId;

    @EntityFieldAnnotation(
            text = "到货通知单号",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String asnKey;

    @EntityFieldAnnotation(
            text = "供应商Id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String supplierId;

    @EntityFieldAnnotation(
            text = "供应商名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String supplierName;
    @TableField(exist = false)
    private String spNamePy;

    @EntityFieldAnnotation(
            text = "DeptId",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deptId;

    @EntityFieldAnnotation(
            text = "科室名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deptName;

    @EntityFieldAnnotation(
            text = "仓库ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String warehouseId;

    @EntityFieldAnnotation(
            text = "仓库名称",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String warehouseName;
    @TableField(exist = false)
    private String warehouseNamePy;

    @EntityFieldAnnotation(
            text = "出入库业务类型",
            length = "",
            not_null = true,
            default_value = "",
            comment = "IN_ASN：供应商入库;IN_DEPT_RETURN:科室退货入库;IN_SHIFT: 调拨入库 OUT_SP:供应商退货出库；OUT_USE:消耗出库；OUT_SHIFT:调拨出库" +
                    ",IN_FSD_WI:智能柜收货入库,IN_FSD_WB:智能柜还货入库,IN_FSD_WT:智能柜移库入库,OUT_FSD_OP:智能柜手术间备货出库(以WorkOrderType.class为主)"
    )
    private String busType;


    @EntityFieldAnnotation(
            text = "入库类型",
            length = "30",
            not_null = false,
            default_value = "",
            comment = "ASN;MANUAL;ORDER(已废弃)"
    )
    @Deprecated
    private String inMode;

    @EntityFieldAnnotation(
            text = "单号",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busKey;

    @EntityFieldAnnotation(
            text = "日期",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Date busDate;

    @EntityFieldAnnotation(
            text = "经手人",
            length = "20",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busUser;

    @EntityFieldAnnotation(
            text = "经手人编码",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String busUserCode;

    @EntityFieldAnnotation(
            text = "送货人",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deliveryman;

    @EntityFieldAnnotation(
            text = "金额",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private Double amount;

    @EntityFieldAnnotation(
            text = "寄售入库标志1：寄售  （代销）0：非寄售（够销）入库需产生记帐单",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagConsignment;

    @EntityFieldAnnotation(
            text = "一物一码入库标志1：一物一码0：非一物一码",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagOmoc;

    @EntityFieldAnnotation(
            text = "开票单ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String invoiceGroupId;

    @EntityFieldAnnotation(
            text = "开票单摘要",
            length = "100",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String invoiceGroupSummary;

    @EntityFieldAnnotation(
            text = "备注",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String remark;

    // creator ,在父类中处理


    // gmt_create ,在父类中处理


    // modifier ,在父类中处理


    // gmt_modified ,在父类中处理

    @EntityFieldAnnotation(
            text = "in:purchase_order.id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String refId;

    @EntityFieldAnnotation(
            text = "到货通知单号",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String refKey;

    @EntityFieldAnnotation(
            text = "",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String refTable;

    @EntityFieldAnnotation(
            text = "交接人",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String handoverPerson;

    @EntityFieldAnnotation(
            text = "方向",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Integer direction;

    @EntityFieldAnnotation(
            text = "允许转配送单",
            length = "",
            not_null = false,
            default_value = "0",
            comment = ""
    )
    private Boolean allowChangeDist;

    @EntityFieldAnnotation(
            text = "关联配送单",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String refDistId;

    @EntityFieldAnnotation(
            text = "允许转调拨单",
            length = "",
            not_null = false,
            default_value = "0",
            comment = ""
    )
    private Boolean allowChangeTransfer;

    @EntityFieldAnnotation(
            text = "关联调拨单",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "0",
            comment = ""
    )
    private String refTransferId;

    @EntityFieldAnnotation(
            text = "采购分类",
            length = "10",
            not_null = false,
            default_value = "matr",
            comment = "matr:耗材，reagent：试剂，drugs：药品"
    )
    private String purchaseOrderType;

    @EntityFieldAnnotation(
            text = "发货温度",
            not_null = false,
            default_value = "0",
            comment = "发货温度"
    )
    private Double deliverTemperature;

    @EntityFieldAnnotation(
            text = "到货温度",
            not_null = false,
            default_value = "0",
            comment = "到货温度"
    )
    private Double arrivalTemperature;

    @EntityFieldAnnotation(
            text = "试剂组id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = ""
    )
    private String reagentTeamId;


    @EntityFieldAnnotation(
            text = "发票号",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String invoiceNo;

    // 是否已转
    @TableField(exist = false)
    private Boolean changeTransferEnd;

    // 手动指定的科室
    @TableField(exist = false)
    private String deptIdTo;

    // 明细数量
    @TableField(exist = false)
    private int countDtl;
    // 试剂组名称
    @TableField(exist = false)
    private String reagentTeamName;

}
